package com.security.door.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.security.door.core.base.BaseService;
import com.security.door.dao.mapper.baseUserRoleMapper;
import com.security.door.model.domain.baseUserRole;
import com.security.door.model.dto.baseUserRoleDto;
import com.security.door.service.IbaseUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class baseUserRoleServiceImpl extends BaseService<baseUserRole> implements IbaseUserRoleService {

    @Autowired
    baseUserRoleMapper ibaseUserRoleMapper;

    public PageInfo<baseUserRole> queryListWithPage(baseUserRoleDto entity) {
        PageHelper.startPage(entity.getPageIndex(), entity.getPageSize());
        var actionList = ibaseUserRoleMapper.queryListWithPage(entity);
        return new PageInfo<>(actionList);
    }

    @Override
    public List<baseUserRole> selectRoleByUserId(String userid) {
        return ibaseUserRoleMapper.selectRoleByUserId(userid);
    }

    @Override
    public boolean hasRegister(baseUserRole record) {
        return ibaseUserRoleMapper.hasRegister(record) > 0 ? true : false;
    }
}
